#!/bin/bash  
  
# 备份原来的软件源列表  
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak  
  
# 使用sed命令替换Ubuntu官方软件源为清华大学镜像源  
sudo sed -i "s/http://.*archive.ubuntu.com/http://mirrors.tuna.tsinghua.edu.cn/g" /etc/apt/sources.list  
sudo sed -i "s/http://.*security.ubuntu.com/http://mirrors.tuna.tsinghua.edu.cn/g" /etc/apt/sources.list  
  
# 更新软件源列表  
sudo apt update  
  
echo "软件源已成功修改为清华大学镜像源！"